package com.asiainfo.cms.system.controller.monitor;

import com.asiainfo.cms.common.result.Result;
import com.asiainfo.cms.common.util.ServletUtils;
import com.asiainfo.cms.system.entity.SysOperLog;
import com.asiainfo.cms.system.service.ISysOperLogService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * 操作日志记录
 *
 * @author ruoyi
 */
@RestController
@RequestMapping("/monitor/operlog")
public class SysOperlogController {
    @Autowired
    private ISysOperLogService operLogService;

    @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
    @GetMapping("/list")
    public Result list(SysOperLog operLog) {
        int pageNum = ServletUtils.getParameterToInt("pageNum");
        int pageSize = ServletUtils.getParameterToInt("pageSize");
        Page<SysOperLog> page = new Page<>(pageNum, pageSize);
        return Result.success(operLogService.selectOperLogList(page, operLog));
    }

 /*   @Log(title = "操作日志", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysOperLog operLog) {
        List<SysOperLog> list = operLogService.selectOperLogList(operLog);
        ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
        util.exportExcel(response, list, "操作日志");
    }*/

    @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
    @DeleteMapping("/{operIds}")
    public Result remove(@PathVariable Long[] operIds) {
        return Result.success(operLogService.deleteOperLogByIds(operIds));
    }

}
